<%--
  Created by IntelliJ IDEA.
  User: Lanan
  Date: 2017/12/13 0013
  Time: 14:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<html>
<head>
    <%@ include file="/commons/basejs.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>微信用户管理</title>
</head>
<body>
<!-- 数据表格 begin -->
<table id="weChat_customer_datagrid" title="微信用户列表" class="easyui-datagrid"
       data-options="
   		url:'${path}/user/weChatCustomer/list.do',
		fit:true,
		idField:'id',
		rownumbers:true,
		toolbar:'#tools',
		pagination:true,
		fitColumns:true,
		singleSelect:true,
   		">
    <thead>
    <th data-options="field:'id', align:'center', checkbox:true">ID</th>
    <th hidden="hidden" data-options="field:'openid', align:'center'"></th>
    <th data-options="field:'userName', align:'center'">用户名</th>
    <th data-options="field:'nickname', align:'center'">微信昵称</th>
    <th data-options="field:'userPhone', align:'center'">电话</th>
    <th data-options="field:'userEmail', align:'center'">Email</th>
    <th data-options="field:'sex', align:'center', formatter:formatterSex">微信性别</th>
    <th data-options="field:'country', align:'center'">微信国家</th>
    <th data-options="field:'province', align:'center'">微信省</th>
    <th data-options="field:'city', align:'center'">微信城市</th>
    <th data-options="field:'headimgurl', align:'center', formatter:formatterImg">微信头像</th>
    <th data-options="field:'createTime', align:'center', formatter:formatDatebox">创建时间</th>
    </thead>
</table>
<div id="tools">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="refreshWeChatCustomerList()">刷新</a>

    <shiro:hasPermission name="/user/weChatCustomer/delete.do">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'" onclick="deleteWeChatCustomer()">删除</a>
    </shiro:hasPermission>
    <label>搜索:</label><input class="easyui-textbox" id="searchInfo" name="searchInfo" data-options="prompt:'请输入搜索关键字'"/>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="searchWeChatCustomer()">搜索</a>
</div>
<!-- 数据表格 end -->


<script type="text/javascript">
    function formatterImg(value){
        if(value!=null){
            return '<img height="40px" src="'+value+'" alt="" />';
        }else{
            return '';
        }
    }

    function formatterSex(value) {
        if (value == 0) {
            return "男";
        } else if (value == 1) {
            return "女";
        } else {
            return "其他";
        }
    }

    function searchWeChatCustomer() {
        var queryParams = {};
        queryParams.searchInfo = $("#searchInfo").val();
        $("#weChat_customer_datagrid").datagrid('options').queryParams = queryParams;
        $("#weChat_customer_datagrid").datagrid('getPager').data("pagination").options.pageNumber = 1;
        $("#weChat_customer_datagrid").datagrid('clearSelections');
        var select = $('#weChat_customer_datagrid').datagrid('getSelected');
        if(select != null){
            $('#weChat_customer_datagrid').datagrid('clearSelections');
        }
        $("#weChat_customer_datagrid").datagrid('reload');
    }

    function refreshWeChatCustomerList() {
        $('#weChat_customer_datagrid').datagrid('reload')
    }

    function deleteWeChatCustomer() {
        lananDelete("weChat_customer_datagrid", "确定要删除该微信用户信息？", "${path}/user/weChatCustomer/delete.do");
    }

</script>

</body>
</html>
